package com.hrms.controller;


import com.hrms.pojo.SysUser;
import com.hrms.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author LK
 * @since 2021-10-19
 */
@RestController
@RequestMapping("/sys-user")
public class SysUserController {
	@Autowired
	SysUserService sysUserService;

	//登录
	@RequestMapping("/login")
	public HashMap<String, Object> login(SysUser user) {
		System.out.println(user + "=======================");

		return sysUserService.login(user);
	}

	//用户列表
	@RequestMapping("/list")
	public HashMap<String, Object> List(SysUser a) {

		return sysUserService.select(a);
	}

	//添加
	@RequestMapping("/add")
	public HashMap<String, Object> add(SysUser a) {
		return sysUserService.add(a);
	}
	//更新
	@RequestMapping("/update")
	public HashMap<String, Object> update(SysUser a) {
		return sysUserService.update(a);
	}
	//删除
	@RequestMapping("/del")
	public HashMap<String, Object> update(Integer id) {
		return sysUserService.del(id);
	}

	//修改当前用户密码
	@RequestMapping("/updatePwd")
	public HashMap<String, Object> updatePwd(SysUser a) {
		return sysUserService.updatePwd(a);
	}
}

